<template>
  <div class="home page-box">
    <h2>功能导航</h2>
    <div class="flex-menu">
      <router-link
        class="menu-item"
        v-for="item in menuList"
        :to="{ name: item.name }"
        :key="item.name"
        >{{ item.title }}</router-link
      >
    </div>
    <h2>常用链接</h2>
    <div class="flex-link">
      <a
        class="link-item"
        :class="item.name"
        v-for="item in linkList"
        :key="item.href"
        :href="item.href"
        target="_blank"
      >
        <img class="link-logo" :src="item.logo" :alt="item.name" />
      </a>
    </div>
  </div>
</template>

<script setup lang="ts">
import menu from '@/hooks/menu'
const { menuList, linkList } = menu()
</script>

<style scoped lang="less">
.home {
  h2 {
    font-size: 22px;
    font-weight: 500;
    line-height: 68px;
    display: flex;
    align-items: center;
    span {
      font-size: 12px;
      color: #666;
      line-height: 20px;
      margin-left: 24px;
    }
  }
  .flex-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    .menu-item {
      background-color: #fff;
      border-radius: 4px;
      flex: 1;
      height: 80px;
      margin-right: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      cursor: pointer;
      transition: var(--el-transition-duration);
      &:hover {
        box-shadow: var(--el-box-shadow-light);
      }
      &:last-child {
        margin-right: 0;
      }
    }
  }

  .flex-link {
    display: flex;
    flex-wrap: wrap;
    .link-item {
      display: flex;
      align-items: center;
      width: 356px;
      margin-right: 16px;
      margin-bottom: 16px;
      background-color: #fff;
      padding: 16px;
      border-radius: 4px;
      cursor: pointer;
      transition: var(--el-transition-duration);
      justify-content: center;
      &:hover {
        box-shadow: var(--el-box-shadow-light);
      }
      &:nth-child(3n) {
        margin-right: 0;
      }
      &.Ethers {
        background-color: #2535a0;
      }
      &.Remix {
        background-color: #2a2c3f;
      }
      &.WalletConnect {
        background-color: #000;
      }
      &.TheGraph {
        background-color: #0c0b1d;
      }
      &.NFTStorage {
        background-color: #ee4116;
      }
      &.LearnBlockChain {
        background-color: #0767c8;
      }
      .link-logo {
        max-height: 42px;
      }
    }
  }
}
@media screen and (max-width: 992px) {
  .home {
    .flex-menu {
      flex-wrap: wrap;
      .menu-item {
        min-width: 90px;
        margin-bottom: 16px;
        &:nth-child(3n) {
          margin-right: 0;
        }
      }
    }
    .flex-link {
      .link-item {
        width: 100%;
        margin-right: 0;
      }
    }
  }
  .block-number {
    bottom: 40px;
    right: 40px;
  }
}
</style>
